<?php

namespace App\Models\Student;

use App\Models\Common\CommonModel;
use App\Models\Constant\StudentConstant;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Student extends CommonModel
{
    use HasFactory;

    protected $table = 'student';

    protected $appends = ['status_name','english_level_name'];

    public function getStatusNameAttribute() {
        return StudentConstant::MAP_STATUS[$this->status]??'未知';
    }
    public function getEnglishLevelNameAttribute() {
        return StudentConstant::MAP_ENGLISH_LEVEL[$this->english_level_id]??'未知';
    }

    //本科院校
    public function getCollege() {
        return $this->hasOne(College::class,'id','college_id');
    }

    //本科专业大类
    public function getMajorClassify() {
        return $this->hasOne(MajorClassify::class,'id','major_classify_id');

    }

    //考研目标院校
    public function getTestPostgraduateCollege() {
        return $this->hasOne(College::class,'id','test_postgraduate_college_id');
    }

    //考研目标专业大类
    public function getTestPostgraduateMajorClassify() {
        return $this->hasOne(MajorClassify::class,'id','test_postgraduate_major_classify_id');
    }


    //你想申请的国外硕士专业
    public function getApplyPostgraduateMajor() {
        return $this->hasOne(MajorClassify::class,'id','apply_postgraduate_major_id');

    }
}
